/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nominalitzacions.ui;

import java.awt.Color;
import java.io.FileNotFoundException;
import java.io.IOException;
//import nominalitzacions.domain.LanguageDomainController;
import java.util.ArrayList;
import nominalitzacions.domain.CorrectWordDomainController;
import nominalitzacions.domain.LanguageDomainController;
import nominalitzacions.domain.Settings;
import nominalitzacions.domain.SettingsDomainController;
import nominalitzacions.domain.TextDomainController;


/**
 *
 * @author sonia.sandalinas
 */
public class PrincipalViewController
{
	private ChangePasswordViewController PDM;
	private PrincipalView PV;
	private LoginAdminViewController LAVC;
        private TextDomainController TDC;
	private LanguageViewController LVC;
	private SettingsViewController SVC;
	private LanguageDomainController LDC;
        private VerbDictionaryViewController VDVC;
        private PairCorpusViewController PCVC;
        
        private SettingsDomainController SDC;
        
	public PrincipalViewController() throws FileNotFoundException, IOException
	{
		PV = new PrincipalView(this);
		PDM = new ChangePasswordViewController();
                TDC = new TextDomainController();
		LVC = new LanguageViewController();
	   	SVC = new SettingsViewController(this);
		LAVC = new LoginAdminViewController(this);
                VDVC = new VerbDictionaryViewController();
                PCVC = new PairCorpusViewController();
                //LDC = new LanguageDomainController();
                
	}
	public void ViewRedefinir()
	{
		PDM.setVisible();
	}
	public void setVisible()
	{
        PV.pack();
		PV.setVisible(true);
                
	}
	public void ViewIdiom()
	{
		 LVC.setVisible();
	}
	public void ViewHelp(String s)
	{
		//HVC.setVisible(s);
	}
	public void ViewSettings() throws FileNotFoundException{
                SVC.setVisible();
        }
	public boolean sendString(String s)
	{

        return true;//return LDC.searchVerb(s);
	}
	public void ViewDictionary()
	{
				//DEC.setVisible();
        }
	public void ViewLogin()
	{
		LAVC.setVisible();

	}
	public void isCorrect()
	{
		LAVC.setInvisible();

	}
	public void isIncorrect()
	{
		LAVC.setInvisible();
	}
        public void on(){
            PV.setEnabled(true);
        }
        public void viewLoginAdmin(String what){
            LAVC.setVisible(what);
        }
        public void goToView(String what){
            if(what.equals("addPair")) {
                PCVC.setVisibleAdd(true);
            }
            else if (what.equals("removePair")){
                PCVC.setVisibleRemove(true);
            }
            else if (what.equals("addDicc")){
                VDVC.setVisibleAdd(true);
            }
            else if (what.equals("removeDicc")){
                VDVC.setVisibleRemove(true);
            }
        }
    /*public String[] getNominalitzacions(String s) {
        String[] nominalitzacions = LDC.getNominalitzacions(s);
        return nominalitzacions;

    }*/
    public String sendPath(String openText){
        String text = TDC.openText(openText);
        return text;
    }
    public int[][] sendText(String texto) throws IOException {
        int[][]allText = TDC.whatHighlight(texto);
        System.out.println("Controlador");
        System.out.println(allText.length);
        return allText;
    }

    public ArrayList<String> getCorrectList(String word) throws IOException{
        CorrectWordDomainController CWDC = new CorrectWordDomainController();
        LDC = new LanguageDomainController();
        LDC.loadLanguage();
        return CWDC.getCorrectList(word, LDC);
    }
    /*public String[] getLanguageNames() {
//        return LDC.getLanguageNames();
    }*/
}